package com.norma.spring.controller;

import com.norma.spring.core.annotation.NormaAutowired;
import com.norma.spring.core.annotation.NormaController;
import com.norma.spring.core.annotation.NormaMapping;
import com.norma.spring.core.annotation.NormaParam;
import com.norma.spring.pojo.User;
import com.norma.spring.service.IUserService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zhangchaofeng
 * @date 2020/11/10
 * @description
 */
@NormaController("/user")
public class UserController {

    @NormaAutowired
    private IUserService userService;

    @NormaMapping("/find")
    public void findUser(@NormaParam("id") String id, @NormaParam("name") String name,
                         HttpServletRequest request, HttpServletResponse response) throws IOException {
        User userInfo = userService.getUserInfo(id, name);
        response.getWriter().println(userInfo.toString());
    }

}
